package com.code2roc.jarmanage.db;

import com.code2roc.jarmanage.model.GroupDO;
import com.code2roc.jarmanage.util.CommonUtil;
import com.code2roc.jarmanage.util.DataBaseUtil;

import java.util.List;

public class GroupDB {
    public static void insert(GroupDO entity) {
        entity.setGroupID(CommonUtil.getNewGuid());
        DataBaseUtil.insert("DepolyGroup", entity);
    }

    public static void delete(String groupID) {
        DataBaseUtil.executeSQL("delete from DepolyGroup where groupID='" + groupID + "'");
    }

    public static void update(GroupDO entity) {
        DataBaseUtil.update("DepolyGroup", entity, "groupID");
    }

    public static GroupDO selectOne(String groupID) {
        return DataBaseUtil.selectOne(GroupDO.class, "DepolyGroup", "groupID", groupID);
    }

    public static List<GroupDO> selectList(String where) {
        return DataBaseUtil.selectList(GroupDO.class, "DepolyGroup", where,"sortNum desc");
    }
}
